<?php
namespace App\Http\Controllers;

use Illuminate\Support\Facades\DB;
use App\Services\CommonServices as Common;

class RedistestController extends Controller{
    // 测试redis
    public function index(){
        // 查询数据
        $data = DB::table('activity_goods')->select('goods_id','yjsx_id','sxzh_id')->get();

        //转换为数组
        $data = Common::object_array($data);

        // 保存到redis
        Common::redis_set('test',$data);

        // 获取redis数据
        $res = Common::redis_get('test');

        return ['code'=>200,'msg'=>'请求成功','data'=>$res];
    }
}
